# Maintainer: Your Name <youremail@domain.com>
pkgname=python-manimce
pkgver=0.19.0
pkgrel=4
epoch=
pkgdesc="Animation engine for explanatory math videos (community edition)."
arch=('any')
url="https://github.com/ManimCommunity/manim"
license=("MIT" "custom")
groups=('local-built')
# 更大缩进的是aur包
depends=(
    "ffmpeg"
    "python"
    "python-beautifulsoup4"
    "python-cairo"
    "python-click"
    "python-colour"
    "python-decorator"
    "python-google-api-core"
    "python-importlib-metadata"
    "python-networkx"
    "python-numpy"
    "python-pillow"
    "python-pydub"
    "python-pygments"
    "python-requests"
    "python-rich"
    "python-scipy"
    "python-setuptools"
    "python-srt"
    "python-tqdm"
    "python-typing_extensions"
    "python-watchdog"

    # archlinuxcn
    "python-av"
    "python-click-default-group"
    # "python-audioop-lts"    # pydub的依赖
    # 本来有但是被archlinuxcn仓库自动删除：
    # "python-skia-pathops"
)
makedepends=(
    "base-devel"
    "python-pip"
    "python-build"
    "python-installer"
    "python-setuptools"
    "python-wheel"
)
checkdepends=()
optdepends=(
    "texlive-core: LaTeX support"
)
# 这里决定内置什么python包
provides=(
	manim python-cloup python-isosurfaces python-manimpango
	python-mapbox-earcut python-moderngl python-glcontext
	python-moderngl-window python-screeninfo python-svgelements
	python-skia-pathops
)
conflicts=("${provides[@]}")
replaces=()
backup=()
options=()
install=
changelog=
source=()
noextract=()
sha256sums=()
validpgpkeys=()

build() {
	pip download --no-deps -i https://pypi.tuna.tsinghua.edu.cn/simple ${provides[*]#python-}
	if [[ ! -d output ]]; then
		mkdir output
	fi
	find ./ -maxdepth 1 -type f -name "*.tar.gz" -exec tar xzf \{\} -C output \;
	for dir in output/* ;do
		python -m build -w -o . $dir
	done
	if [[ ! -d root ]]; then
		mkdir root
	fi
	find ./ -maxdepth 1 -type f -name "*.whl" -exec python -m installer --destdir="root" \{\} \;
}

package() {
	mv root/* $pkgdir
}
